﻿/*
 * This software is the confidential and proprietary
 * information of NetBay
 * Such confidential information should not be disclosed
 * NetBay copyright(c) 2010
 */

#region Using
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ComponentModel.DataAnnotations;
using System.ServiceModel.DomainServices.Server;
using System.Text;
#endregion

namespace NetBay.Core.BusinessEntities
{
    /// <summary>
    /// DATABASE TABLENAME : r_entite
    /// </summary>
    [DataContract]
    public class Organization : ReturnObject
    {
        #region Private members
        /// <summary>
        /// 
        /// </summary>
        private long m_lIdentifier;

        /// <summary>
        /// 
        /// </summary>
        private long m_lGroupIdentifier;

        /// <summary>
        /// Indicate the name of the organization (re_nom)
        /// </summary>
        private string m_sName;

        /// <summary>
        /// Indicate the Descrition of the Organization (re_description)
        /// </summary>
        private string m_sDescription;

        /// <summary>
        /// Indicate whether the Organization is deleted (rd_suppr)
        /// </summary>
        private bool m_bDeleted;

        /// <summary>
        /// 
        /// </summary>
        private List<FolderType> m_lstFolderType = new List<FolderType>();

        #endregion

        #region Properties

        /// <summary>
        /// Get or Set the group identifier 
        /// </summary>
        [DataMember]
        public long GroupIdentifier
        {
            get { return m_lGroupIdentifier; }
            set { m_lGroupIdentifier = value; }
        }

        /// <summary>
        /// Get or set the unique identifier (re_id)
        /// </summary>
        [DataMember]
        public long Identifier
        {
            get { return m_lIdentifier; }
            set { m_lIdentifier = value; }
        }

        /// <summary>
        /// Indicate the name of the organization (re_nom)
        /// </summary>
        [DataMember]
        public string Name
        {
            get { return m_sName; }
            set { m_sName = value; }
        }

        /// <summary>
        /// Indicate the Descrition of the Organization (re_description)
        /// </summary>
        [DataMember]
        public string Description
        {
            get { return m_sDescription; }
            set { m_sDescription = value; }
        }

        /// <summary>
        /// Indicate whether the organization is deleted (re_suppr)
        /// </summary>
        [DataMember]
        public bool Deleted
        {
            get { return m_bDeleted; }
            set { m_bDeleted = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [Association("FolderTypesList", "Key", "ForeignKey")]
        [Include]
        [DataMember]
        public List<FolderType> FolderTypesList
        {
            get { return m_lstFolderType; }
            set 
            { 
                m_lstFolderType = value;
                ItemEntity.SetForeignKey(m_lstFolderType, Key);
            }
        }


        /// <summary>
        /// Gets or sets the rank.
        /// </summary>
        /// <value>
        /// The rank.
        /// </value>
        [DataMember]
        public int Rank { get; set; }

        #endregion


        #region ToString
        /// <summary>
        /// Extend default description of class
        /// </summary>
        /// <returns>description of instance</returns>
        public override string ToString()
        {
            StringBuilder parameters = new StringBuilder("Identifier<", 4096);
            parameters.Append(Identifier); parameters.Append("> ");
            parameters.Append("Name<"); parameters.Append(Name); parameters.Append("> ");
            parameters.Append("Description<"); parameters.Append(Description); parameters.Append("> ");

            return parameters.ToString();
        }
        #endregion
        


        public override object Clone()
        {
            throw new NotImplementedException();
        }
    }

    public abstract class OrganizationDer : Organization
    {
        #region Abstract method
        public abstract void SetFolderTypeList(long p_lUserId);
        #endregion
    }

}
